<!--环境信息年报 RptAnnual-->
<template>
    <Layout>
        <Form ref="queryForm" :model="dataToQuery" :label-width="120">
            <Row v-show="!switchFlag" class="query-form" >
                <Col span="8">
                    <FormItem label="企业名称：" prop="order">
                        <cascader-dom class="query-form-el" ref='queryOrgCascader' @setOrgInfo='setQueryCompanyId' :orgTree="true"
                                      :currentOrgId="dataToQuery.companyId" :setCurrentName="{label:dataToQuery.companyName,value:dataToQuery.companyId}"></cascader-dom>
                    </FormItem>
                </Col>
                <Col span="8">
                    <FormItem label='年度：' prop='year'>
                        <DatePicker class="query-form-el" :clearable="false" placeholder="请选择年度" v-model='dataToQuery.yearDate' type="year"></DatePicker>
                    </FormItem>
                </Col>
                <Col span="8">
                    <Button @click="reset" class="ivu-btn-reset">重置</Button>
                    <Button type="primary" class="ivu-btn-query" icon="md-search"  @click="query">查询</Button>
                </Col>
            </Row>
            <Row class="query-form">
                <Col span="24">
                    <Button size="large"  class="ivu-btn-add" icon="md-add"  @click="addInfo">新增</Button>
                    <Button size="large"  class="ivu-btn-add" icon="md-download"  @click="downloadDescriptionExcel">填报说明下载</Button>
                    <Button type="primary" class="ivu-btn-add"   icon="md-cloud-download"  @click="exportFormSubmit">导出</Button>
                </Col>
            </Row>
        </Form>
        <Table ref='table' :height="tableHeight" :row-class-name="rowClassName" no-data-text="没有查询到相关数据!" @on-selection-change = 'getSelectRows' :loading='pageStatus.loading'
               border :columns="columns1"  :data="dataTable" >
        </Table>
        <Row style="margin-right:10px;">
            <Col span="24" >
                <Page style="float: right" :total="pagedata.total" :page-size="pagedata.pageSize" @on-change="pageChange" @on-page-size-change="pageSizeChange" :page-size-opts="pageSizeArray" show-total show-sizer show-elevator />
            </Col>
        </Row>
        <Modal :title="getModalTitle('环境信息年报')" :transfer=false :mask-closable="false" v-model="dialogShow" v-if="dataToView && dialogShow" :width=1200 :styles="{height:'auto'}"  class-name='limit-height-dialog'>
            <Row>
                <Col span="24">
                    <Form ref="dialogForm" :class="mode === 'view'?'modal-view-detail':'modal-form'" :show-message="false" :model="dataToView" :rules="mode === 'view'?{} :ruleCustom"  :label-position="mode === 'view'?'right':'top'" :label-width="mode === 'view'?null:null">
                        <Row type="flex" justify="space-around" class="code-row-bg">
                            <Col span="2"><b>基本信息</b></Col>
                            <Col span="20">
                                <Col span="8" class="pl10">
                                    <FormItem label='企业名称：' prop='companyId'>
                                        <div v-if="mode === 'view'">{{dataToView.companyName}}</div>
                                        <cascader-dom v-else ref='orgCascader' @setOrgInfo='setCompanyId' @setOrgname="setCompanyName" :orgTree="true" :currentOrgId = "dataToView.companyId" :setCurrentName="{label:dataToView.companyName,value:dataToView.companyId}" ></cascader-dom>
                                    </FormItem>
                                </Col>
                                <Col span="8" class="pl10">
                                    <FormItem label='二级集团：' prop='orgId'>
                                        <div v-if="mode === 'view'">{{dataToView.belongOrgName}}</div>
                                        <Input v-else type="text" v-model='dataToView.belongOrgName' readonly></Input>
    <!--                                <cascader-dom v-else ref='orgCascader' @setOrgInfo='setCompanyId' @setOrgname="setCompanyName" :orgTree="true" :currentOrgId = "dataToView.companyId" :setCurrentName="{label:dataToView.companyName,value:dataToView.companyId}" ></cascader-dom>-->
                                    </FormItem>
                                </Col>
                                <Col span="8" class="pl10">
                                    <FormItem label='年度：' prop='rptPeroidDate'>
                                        <div v-if="mode === 'view'">{{ dataToView.rptPeroid }}</div>
                                        <DatePicker v-else class="w" placeholder="请选择年度" v-model='dataToView.rptPeroidDate' type="year"></DatePicker>
                                    </FormItem>
                                </Col>
                                <Col span="8" class="pl10">
                                <FormItem label='填表人：' prop='registrant'>
                                    <div v-if="mode === 'view'">{{dataToView.createUserName}}</div>
                                    <Input v-else type='text' v-model='dataToView.createUserName' readonly></Input>
                                </FormItem>
                                </Col>
                                <Col span="8" class="pl10">
                                <FormItem label='填表时间：' prop='registTime'>
                                    <div v-if="mode === 'view'">{{renderViewDate(dataToView.createDate)}}</div>
                                    <DatePicker v-else type="date" placeholder="请选择日期" class="query-form-el" v-model='dataToView.createDate' readonly></DatePicker>
                                </FormItem>
                                </Col>
								<Col span="8" class="pl10">
								<FormItem label='填表人电话：' prop='createMobile'>
									<div v-if="mode === 'view'">{{dataToView.createMobile}}</div>
									<Input v-if="mode === 'add'" type='text' v-model='dataToView.createMobile'></Input>
									<Input v-if="mode === 'edit'" type='text' v-model='dataToView.createMobile' :readonly="this.currentUser.userId === dataToView.createUserId ? false : 'readonly'"></Input>
								</FormItem>
								</Col>
                            </Col>
                        </Row>

                        <template v-if="isFieldVisible(['dioxinEmission','soEmission','otherEmission','exhaustEmission','pmEmission','noxEmission'])">
                            <hr class='mt10 mb10' style="color: #dcdcdc"/>
                            <Row type="flex" justify="space-around" class="code-row-bg">
                                <Col span="2"><b>大气污染物</b></Col>
                                <Col span="20">
                                <Col span="8" class="pl10" v-if="isFieldVisible(['exhaustEmission'])">
                                <FormItem label='废气排放总量（标准立方米）：' prop='exhaustEmission'>
                                    <div v-if="mode === 'view'">{{ dataToView.exhaustEmission }}</div>
                                    <InputNumber v-else class='w'placeholder="请填写废气排放总量（标准立方米）" type='text' v-model='dataToView.exhaustEmission'></InputNumber>
                                </FormItem>
                                </Col>
                                <Col span="8" class="pl10" v-if="isFieldVisible(['soEmission'])">
                                <FormItem label='SO2排放量（吨）：' prop='soEmission'>
                                    <div v-if="mode === 'view'">{{ dataToView.soEmission }}</div>
                                    <InputNumber v-else class='w'placeholder="请填写SO2排放量（吨）" type='text' v-model='dataToView.soEmission'></InputNumber>
                                </FormItem>
                                </Col>
                                <Col span="8" class="pl10" v-if="isFieldVisible(['noxEmission'])">
                                <FormItem label='NOx排放量（吨）：' prop='noxEmission'>
                                    <div v-if="mode === 'view'">{{ dataToView.noxEmission }}</div>
                                    <InputNumber v-else class='w'placeholder="请填写NOx排放量（吨）" type='text' v-model='dataToView.noxEmission'></InputNumber>
                                </FormItem>
                                </Col>
                                <Col span="8" class="pl10" v-if="isFieldVisible(['pmEmission'])">
                                <FormItem label='颗粒物排放量（吨）：' prop='pmEmission'>
                                    <div v-if="mode === 'view'">{{ dataToView.pmEmission }}</div>
                                    <InputNumber v-else class='w'placeholder="请填写颗粒物排放量（吨）" type='text' v-model='dataToView.pmEmission'></InputNumber>
                                </FormItem>
                                </Col>
                                <Col span="8" class="pl10" v-if="isFieldVisible(['dioxinEmission'])">
                                <FormItem label='二恶英排放量（吨）：' prop='dioxinEmission'>
                                    <div v-if="mode === 'view'">{{ dataToView.dioxinEmission }}</div>
                                    <InputNumber v-else class='w'placeholder="请填写二恶英排放量（吨）" type='text' v-model='dataToView.dioxinEmission'></InputNumber>
                                </FormItem>
                                </Col>
                                <Col span="8" class="pl10" v-if="isFieldVisible(['otherEmission'])">
                                <FormItem label='其他废气（吨）：' prop='otherEmission'>
                                    <div v-if="mode === 'view'">{{ dataToView.otherEmission }}</div>
                                    <InputNumber v-else class='w'placeholder="请填写其他废气（吨）" type='text' v-model='dataToView.otherEmission'></InputNumber>
                                </FormItem>
                                </Col>
                                </Col>
                            </Row>
                        </template>
                        <template v-if="isFieldVisible(['hmiMission','codEmission','wasterWaterEmission'])">
                            <hr class='mt10 mb10' style="color: #dcdcdc"/>
                            <Row type="flex" justify="space-around" class="code-row-bg">
                                <Col span="2"><b>水污染物</b></Col>
                                <Col span="20">
                                <Col span="8" class="pl10" v-if="isFieldVisible(['wasterWaterEmission'])">
                                <FormItem label='废水排放总量（吨）：' prop='wasterWaterEmission'>
                                    <div v-if="mode === 'view'">{{ dataToView.wasterWaterEmission }}</div>
                                    <InputNumber v-else class='w'placeholder="请填写废水排放总量（吨）" type='text' v-model='dataToView.wasterWaterEmission'></InputNumber>
                                </FormItem>
                                </Col>
                                <Col span="8" class="pl10" v-if="isFieldVisible(['codEmission'])">
                                <FormItem label='COD排放量（吨）：' prop='codEmission'>
                                    <div v-if="mode === 'view'">{{ dataToView.codEmission }}</div>
                                    <InputNumber v-else class='w'placeholder="请填写COD排放量（吨）" type='text' v-model='dataToView.codEmission'></InputNumber>
                                </FormItem>
                                </Col>
                                <Col span="8" class="pl10" v-if="isFieldVisible(['hmiMission'])">
                                <FormItem label='重金属离子排放量（吨）：' prop='hmiMission'>
                                    <div v-if="mode === 'view'">{{ dataToView.hmiMission }}</div>
                                    <InputNumber v-else class='w'placeholder="请填写重金属离子排放量（吨）" type='text' v-model='dataToView.hmiMission'></InputNumber>
                                </FormItem>
                                </Col>
                                </Col>
                            </Row>
                        </template>
                        <template v-if="isFieldVisible(['paintTreatmentAmount','otherTreatmentAmount','oilTreatmentAmount','hazardousWasteEmissions','hazardousWasteDensity','hazardousWasteDisposalRate'])">
                            <hr class='mt10 mb10' style="color: #dcdcdc"/>
                            <Row type="flex" justify="space-around" class="code-row-bg">
                                <Col span="2"><b>危险废弃物</b></Col>
                                <Col span="20">
                                <Col span="8" class="pl10" v-if="isFieldVisible(['oilTreatmentAmount'])">
                                <FormItem label='废弃机油处理量（吨）：' prop='oilTreatmentAmount'>
                                    <div v-if="mode === 'view'">{{ dataToView.oilTreatmentAmount }}</div>
                                    <InputNumber v-else class='w' placeholder="请填写废弃机油处理量（吨）" type='text' v-model='dataToView.oilTreatmentAmount'></InputNumber>
                                </FormItem>
                                </Col>
                                <Col span="8" class="pl10" v-if="isFieldVisible(['paintTreatmentAmount'])">
                                <FormItem label='废弃油漆处理量（吨）：' prop='paintTreatmentAmount'>
                                    <div v-if="mode === 'view'">{{ dataToView.paintTreatmentAmount }}</div>
                                    <InputNumber v-else class='w' placeholder="请填写废弃油漆处理量（吨）" type='text' v-model='dataToView.paintTreatmentAmount'></InputNumber>
                                </FormItem>
                                </Col>
                                <Col span="8" class="pl10" v-if="isFieldVisible(['otherTreatmentAmount'])">
                                <FormItem label='其他危险废物产生及处理量（吨）：' prop='otherTreatmentAmount'>
                                    <div v-if="mode === 'view'">{{ dataToView.otherTreatmentAmount }}</div>
                                    <InputNumber v-else class='w' placeholder="请填写其他包含在《国家危险废物名录》中的其他危险废物产生及处理量（吨）" type='text' v-model='dataToView.otherTreatmentAmount'></InputNumber>
                                </FormItem>
                                </Col>
								<Col span="8" class="pl10" v-if="isFieldVisible(['hazardousWasteEmissions'])">
								<FormItem label='危险废弃物排放总量（吨）：' prop='hazardousWasteEmissions'>
								    <div v-if="mode === 'view'">{{ dataToView.hazardousWasteEmissions }}</div>
								    <InputNumber v-else class='w' placeholder="请填写危险废弃物排放总量（吨）" type='text' v-model='dataToView.hazardousWasteEmissions'></InputNumber>
								</FormItem>
								</Col>
								<Col span="8" class="pl10" v-if="isFieldVisible(['hazardousWasteDensity'])">
								<FormItem label='危险废弃物产生密度（吨/万元）：' prop='hazardousWasteDensity'>
								    <div v-if="mode === 'view'">{{ dataToView.hazardousWasteDensity }}</div>
								    <InputNumber v-else class='w' placeholder="请填写危险废弃物产生密度（吨/万元）" type='text' v-model='dataToView.hazardousWasteDensity'></InputNumber>
								</FormItem>
								</Col>
								<Col span="8" class="pl10" v-if="isFieldVisible(['hazardousWasteDisposalRate'])">
								<FormItem label='危险废弃物处置率（%）：' prop='hazardousWasteDisposalRate'>
								    <div v-if="mode === 'view'">{{ dataToView.hazardousWasteDisposalRate }}</div>
								    <InputNumber v-else class='w' placeholder="请填写危险废弃物处置率（%）" type='text' v-model='dataToView.hazardousWasteDisposalRate'></InputNumber>
								</FormItem>
								</Col>
                                </Col>
                            </Row>
                        </template>
                        <template v-if="isFieldVisible(['rockTreatmentAmount','tailingsTreatmentAmount','otherWasterAmount','cementAmount','harmlessWasteEmissions','harmlessWasteDensity'])">
                            <hr class='mt10 mb10' style="color: #dcdcdc"/>
                            <Row type="flex" justify="space-around" class="code-row-bg">
                                <Col span="2"><b>无害废弃物</b></Col>
                                <Col span="20">
									<Col span="8" class="pl10" v-if="isFieldVisible(['harmlessWasteEmissions'])">
									<FormItem label='无害废弃物排放总量（吨）：' prop='harmlessWasteEmissions'>
									    <div v-if="mode === 'view'">{{ dataToView.harmlessWasteEmissions }}</div>
									    <InputNumber v-else class='w' placeholder="请填写无害废弃物排放总量（吨）" type='text' v-model='dataToView.harmlessWasteEmissions'></InputNumber>
									</FormItem>
									</Col>
									<Col span="8" class="pl10" v-if="isFieldVisible(['harmlessWasteDensity'])">
									<FormItem label='无害废弃物密度（吨/万元）：' prop='harmlessWasteDensity'>
									    <div v-if="mode === 'view'">{{ dataToView.harmlessWasteDensity }}</div>
									    <InputNumber v-else class='w' placeholder="请填写无害废弃物密度（吨/万元）" type='text' v-model='dataToView.harmlessWasteDensity'></InputNumber>
									</FormItem>
									</Col>
                                    <Col span="8" class="pl10" v-if="isFieldVisible(['rockTreatmentAmount'])">
                                        <FormItem label='矿山废石处理量（吨）：' prop='rockTreatmentAmount'>
                                            <div v-if="mode === 'view'">{{ dataToView.rockTreatmentAmount }}</div>
                                            <InputNumber v-else class='w'placeholder="请填写矿山废石处理量（吨）" type='text' v-model='dataToView.rockTreatmentAmount'></InputNumber>
                                        </FormItem>
                                    </Col>
                                    <Col span="8" class="pl10" v-if="isFieldVisible(['tailingsTreatmentAmount'])">
                                        <FormItem label='尾矿产生及处理量（吨）：' prop='tailingsTreatmentAmount'>
                                            <div v-if="mode === 'view'">{{ dataToView.tailingsTreatmentAmount }}</div>
                                            <InputNumber v-else class='w'placeholder="请填写尾矿产生及处理量（吨）" type='text' v-model='dataToView.tailingsTreatmentAmount'></InputNumber>
                                        </FormItem>
                                    </Col>
                                    <Col span="8" class="pl10" v-if="isFieldVisible(['cementAmount'])">
                                        <FormItem label='水泥窑协同处置年处理量（吨）：' prop='cementAmount'>
                                            <div v-if="mode === 'view'">{{ dataToView.cementAmount }}</div>
                                            <InputNumber v-else class='w'placeholder="请填写水泥窑协同处置年处理量（吨）" type='text' v-model='dataToView.cementAmount'></InputNumber>
                                        </FormItem>
                                    </Col>
                                    <Col span="8" class="pl10" v-if="isFieldVisible(['otherWasterAmount'])">
                                        <FormItem label='其他废弃物产生量（吨）：' prop='otherWasterAmount'>
                                            <div v-if="mode === 'view'">{{ dataToView.otherWasterAmount }}</div>
                                            <InputNumber v-else class='w'placeholder="请填写其他废弃物产生量（吨）" type='text' v-model='dataToView.otherWasterAmount'></InputNumber>
                                        </FormItem>
                                    </Col>
                                </Col>
                            </Row>
                        </template>

                        <template v-if="isFieldVisible(['isoAmount','rdInvestment','soReduceAmount','noxReduceAmount','pmReduceAmount','waterReduceAmount','codReduceAmount'])">
                            <hr class='mt10 mb10' style="color: #dcdcdc"/>
                            <Row type="flex" justify="space-around" class="code-row-bg">
                                <Col span="2"><b>减低排放量的措施及所得结果</b></Col>
                                <Col span="20">
                                <Col span="12" class="pl10" v-if="isFieldVisible(['isoAmount'])">
                                <FormItem label='ISO 14001体系认证通过数量（个）：' prop='isoAmount'>
                                    <div v-if="mode === 'view'">{{ dataToView.isoAmount }}</div>
                                    <InputNumber v-else class='w'placeholder="请填写ISO 14001体系认证通过数量（个）" min="0" type='text' v-model='dataToView.isoAmount'></InputNumber>
                                </FormItem>
                                </Col>
                                <Col span="12" class="pl10" v-if="isFieldVisible(['rdInvestment'])">
                                <FormItem label='环保减排项目研发投入（元）：' prop='rdInvestment'>
                                    <div v-if="mode === 'view'">{{ dataToView.rdInvestment }}</div>
                                    <InputNumber v-else class='w'placeholder="请填写环保减排项目研发投入（元）" min="0" type='text' v-model='dataToView.rdInvestment'></InputNumber>
                                </FormItem>
                                </Col>
                                <Col span="12" class="pl10" v-if="isFieldVisible(['soReduceAmount'])">
                                <FormItem label='SO2排放减少量/年（吨）：' prop='soReduceAmount'>
                                    <div v-if="mode === 'view'">{{ dataToView.soReduceAmount }}</div>
                                    <InputNumber v-else class='w'placeholder="请填写SO2排放减少量/年（吨）" type='text' v-model='dataToView.soReduceAmount'></InputNumber>
                                </FormItem>
                                </Col>
                                <Col span="12" class="pl10" v-if="isFieldVisible(['noxReduceAmount'])">
                                <FormItem label='NOX排放减少量/年（吨）：' prop='noxReduceAmount'>
                                    <div v-if="mode === 'view'">{{ dataToView.noxReduceAmount }}</div>
                                    <InputNumber v-else class='w'placeholder="请填写NOX排放减少量/年（吨）" type='text' v-model='dataToView.noxReduceAmount'></InputNumber>
                                </FormItem>
                                </Col>
                                <Col span="12" class="pl10" v-if="isFieldVisible(['pmReduceAmount'])">
                                <FormItem label='颗粒物排放减少量/年（吨）：' prop='pmReduceAmount'>
                                    <div v-if="mode === 'view'">{{ dataToView.pmReduceAmount }}</div>
                                    <InputNumber v-else class='w'placeholder="请填写颗粒物排放减少量/年（吨）" type='text' v-model='dataToView.pmReduceAmount'></InputNumber>
                                </FormItem>
                                </Col>
                                <Col span="12" class="pl10" v-if="isFieldVisible(['waterReduceAmount'])">
                                <FormItem label='废水减排总量/年（吨）：' prop='waterReduceAmount'>
                                    <div v-if="mode === 'view'">{{ dataToView.waterReduceAmount }}</div>
                                    <InputNumber v-else class='w'placeholder="请填写废水减排总量/年（吨）" type='text' v-model='dataToView.waterReduceAmount'></InputNumber>
                                </FormItem>
                                </Col>
                                <Col span="12" class="pl10" v-if="isFieldVisible(['codReduceAmount'])">
                                <FormItem label='COD排放减少量/年（吨）：' prop='codReduceAmount'>
                                    <div v-if="mode === 'view'">{{ dataToView.codReduceAmount }}</div>
                                    <InputNumber v-else class='w'placeholder="请填写COD排放减少量/年（吨）" type='text' v-model='dataToView.codReduceAmount'></InputNumber>
                                </FormItem>
                                </Col>
                                </Col>
                            </Row>
                        </template>

                        <!--<Row type="flex" justify="space-around" class="code-row-bg" v-if="isFieldVisible(['envBenefitsFiles'])">-->
                            <!--<Col span="23">-->
                            <!--<FormItem v-if="mode === 'view'" label="环保减排项目及环保效益：">-->
                                <!--<div v-show="dataToView.envBenefitsFiles.length>0" v-for="item in dataToView.envBenefitsFiles">-->
                                    <!--<a @click="downloadFile(item)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>-->
                                <!--</div>-->
                            <!--</FormItem>-->
                            <!--<FormItem v-else label="环保减排项目及环保效益：">-->
                                <!--<div>-->
                                    <!--<Upload ref="upload"-->
                                            <!--:before-upload="(file) => { beforeUpload(file, 'envBenefits') }"-->
                                            <!--:show-upload-list="true"-->
                                            <!--:max-size="10240"-->
                                            <!--multiple-->
                                            <!--type="drag"-->
                                            <!--:action="fileUrl">-->
                                        <!--<div style="padding: 10px">-->
                                            <!--<Icon type="ios-cloud-upload" size="45" style="color: #3399ff"></Icon>-->
                                            <!--<p>点击将文件拖拽到这里上传</p>-->
                                            <!--<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>-->
                                        <!--</div>-->
                                    <!--</Upload>-->
                                <!--</div>-->
                                <!--<div v-show="dataToView.envBenefitsFiles.length>0" v-for="item in dataToView.envBenefitsFiles" :key='item'>-->
                                    <!--<a @click="downloadFile(item)">{{ item.fileName }}</a>-->
                                    <!--<Button type="text" icon="md-trash" @click="removeFile(item.id, 'envBenefits')" style="margin-left: 5px;margin-bottom: 3px"/>-->
                                <!--</div>-->
                            <!--</FormItem>-->
                            <!--</Col>-->
                        <!--</Row>-->
                        <!--<Row type="flex" justify="space-around" class="code-row-bg" v-if="isFieldVisible(['epRelatedAwardsFiles'])">-->
                            <!--<Col span="23">-->
                                <!--<FormItem v-if="mode === 'view'" label="环保相关奖项：">-->
                                    <!--<div v-show="dataToView.epRelatedAwardsFiles.length>0" v-for="item in dataToView.epRelatedAwardsFiles">-->
                                        <!--<a @click="downloadFile(item)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>-->
                                    <!--</div>-->
                                <!--</FormItem>-->
                                <!--<FormItem v-else label="环保相关奖项：">-->
                                    <!--<div>-->
                                        <!--<Upload ref="upload"-->
                                                <!--:before-upload="(file) => { beforeUpload(file, 'epRelatedAwards') }"-->
                                                <!--:show-upload-list="true"-->
                                                <!--:max-size="10240"-->
                                                <!--multiple-->
                                                <!--type="drag"-->
                                                <!--:action="fileUrl">-->
                                            <!--<div style="padding: 10px">-->
                                                <!--<Icon type="ios-cloud-upload" size="45" style="color: #3399ff"></Icon>-->
                                                <!--<p>点击将文件拖拽到这里上传</p>-->
                                                <!--<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>-->
                                            <!--</div>-->
                                        <!--</Upload>-->
                                    <!--</div>-->
                                    <!--<div v-show="dataToView.epRelatedAwardsFiles.length>0" v-for="item in dataToView.epRelatedAwardsFiles" :key='item'>-->
                                        <!--<a @click="downloadFile(item)">{{ item.fileName }}</a>-->
                                        <!--<Button type="text" icon="md-trash" @click="removeFile(item.id, 'epRelatedAwards')" style="margin-left: 5px;margin-bottom: 3px"/>-->
                                    <!--</div>-->
                                <!--</FormItem>-->
                            <!--</Col>-->
                        <!--</Row>-->
                        <!--<Row type="flex" justify="space-around" class="code-row-bg" v-if="isFieldVisible(['relatedProjectsFiles'])">-->
                            <!--<Col span="23">-->
                                <!--<FormItem v-if="mode === 'view'" label="与科研机构合作环保相关项目：">-->
                                    <!--<div v-show="dataToView.relatedProjectsFiles.length>0" v-for="item in dataToView.relatedProjectsFiles">-->
                                        <!--<a @click="downloadFile(item)"><span style="color: #3399ff;margin-left: 5px">{{ item.fileName }}</span></a>-->
                                    <!--</div>-->
                                <!--</FormItem>-->
                                <!--<FormItem v-else label="与科研机构合作环保相关项目：">-->
                                    <!--<div>-->
                                        <!--<Upload ref="upload"-->
                                                <!--:before-upload="(file) => { beforeUpload(file, 'relatedProjects') }"-->
                                                <!--:show-upload-list="true"-->
                                                <!--:max-size="10240"-->
                                                <!--multiple-->
                                                <!--type="drag"-->
                                                <!--:action="fileUrl">-->
                                            <!--<div style="padding: 10px">-->
                                                <!--<Icon type="ios-cloud-upload" size="45" style="color: #3399ff"></Icon>-->
                                                <!--<p>点击将文件拖拽到这里上传</p>-->
                                                <!--<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>-->
                                            <!--</div>-->
                                        <!--</Upload>-->
                                    <!--</div>-->
                                    <!--<div v-show="dataToView.relatedProjectsFiles.length>0" v-for="item in dataToView.relatedProjectsFiles" :key='item'>-->
                                        <!--<a @click="downloadFile(item)">{{ item.fileName }}</a>-->
                                        <!--<Button type="text" icon="md-trash" @click="removeFile(item.id, 'relatedProjects')" style="margin-left: 5px;margin-bottom: 3px"/>-->
                                    <!--</div>-->
                                <!--</FormItem>-->
                            <!--</Col>-->
                        <!--</Row>-->
                    </Form>
                </Col>
            </Row>
            <div slot="footer">
                <Button v-if="mode != 'view'" type="primary"  class='ivu-btn-save' @click="submit('dialogForm')" >确定</Button>
                <Button v-if="mode != 'view'" type="primary"  class='ivu-btn-cancel' @click="handleCancel" >取消</Button>
                <Button v-if="mode === 'view'" class='ivu-btn-save' @click="dialogShow=false">关闭</Button>
            </div>
        </Modal>
    </Layout>
</template>

<script>
    import {Api} from '@/api/index.js'
    import orgFieldOptions from './orgFieldOptions'
    var cascaderDom = () => import('@/components/cascader-dom.vue');
    import pageCommonFunction from '@/components/pageCommonFunction.js'
	import { sessionStorage } from '@/common/cacheUtils.js'
    export default {
        name: "rptAnnual",
        components:{
            cascaderDom
        },
        data(){
            return {
                ...this.createCommonDataField(),
                // 列表
                columns1: [
                    { title: '序号', width: 80, fixed: 'left', align: 'center', render: (h, params) => {
                        if(params.index == 0) return h('span', "汇总");
                        return h('span', (params.index - 1) + (this.pagedata.currentPage - 1) * this.pagedata.pageSize + 1);
                    }},
                    { key:'companyName',title: '企业名称', fixed: 'left', align: 'center', minWidth:200 },
                    { key:'rptPeroid',title: '年度', fixed: 'left', align: 'center', minWidth:80 },
                    // { key:'ggEmissions',title: '温室气体排放量(吨)',  align: 'center', minWidth:100 },
                    // { key:'cementProcess',title: '水泥板块产生环境影响的重点工艺流程',  align: 'center', minWidth:145 },
                    { key:'exhaustEmission',title: '废气排放总量（标准立方米）',  align: 'center' , minWidth:130 },
                    { key:'soEmission',title: 'SO2排放量（吨）',  align: 'center' , minWidth:120 },
                    { key:'noxEmission',title: 'NOx排放量（吨）',  align: 'center' , minWidth:120 },
                    { key:'pmEmission',title: '颗粒物排放量（吨）',  align: 'center' , minWidth:120 },
                    { key:'dioxinEmission',title: '二恶英排放量（吨）',  align: 'center' , minWidth:120 },
                    { key:'otherEmission',title: '其他废气（吨）',  align: 'center' , minWidth:120 },
                    { key:'wasterWaterEmission',title: '废水排放总量（吨）',  align: 'center' , minWidth:120 },
                    { key:'codEmission',title: 'COD排放量（吨）',  align: 'center' , minWidth:120},
                    { key:'hmiMission',title: '重金属离子排放量（吨）',  align: 'center' , minWidth:135},
					{ key:'hazardousWasteEmissions',title: '危险废弃物排放总量（吨）',  align: 'center' , minWidth:150},
					{ key:'hazardousWasteDensity',title: '危险废弃物产生密度（吨/万元）',  align: 'center' , minWidth:150},
					{ key:'hazardousWasteDisposalRate',title: '危险废弃物处置率（%）',  align: 'center' , minWidth:150},
                    { key:'oilTreatmentAmount',title: '废弃机油处理量（吨）',  align: 'center' , minWidth:150},
                    { key:'paintTreatmentAmount',title: '废弃油漆处理量（吨）',  align: 'center', minWidth:150 },
                    { key:'otherTreatmentAmount',title: '其他包含在《国家危险废物名录》中的其他危险废物产生及处理量（吨）',  align: 'center', minWidth:230},
                    { key:'harmlessWasteEmissions',title: '无害废弃物排放总量（吨）',  align: 'center' , minWidth:150},
                    { key:'harmlessWasteDensity',title: '无害废弃物密度（吨/万元）',  align: 'center' , minWidth:150},
					{ key:'rockTreatmentAmount',title: '矿山废石处理量（吨）',  align: 'center', minWidth:150 },
					{ key:'tailingsTreatmentAmount',title: '尾矿产生及处理量（吨）',  align: 'center', minWidth:150 },
                    { key:'cementAmount',title: '水泥窑协同处置年处理量（吨）',  align: 'center' , minWidth:150},
                    { key:'otherWasterAmount',title: '其他废弃物产生量（吨）',  align: 'center' , minWidth:150},
                    { key:'isoAmount',title: 'ISO 14001体系认证通过数量（个）',  align: 'center', minWidth:160 },
                    // { key:'envBenefits',title: '环保减排项目及环保效益',  align: 'center' , minWidth:120},
                    { key:'rdInvestment',title: '环保减排项目研发投入（元）',  align: 'center', minWidth:125 },
                    { key:'soReduceAmount',title: 'SO2排放减少量/年（吨）',  align: 'center', minWidth:145 },
                    { key:'noxReduceAmount',title: 'NOX排放减少量/年（吨）',  align: 'center', minWidth:145 },
                    { key:'pmReduceAmount',title: '颗粒物排放减少量/年（吨）',  align: 'center', minWidth:150 },
                    { key:'waterReduceAmount',title: '废水减排总量/年（吨）',  align: 'center', minWidth:145 },
                    { key:'codReduceAmount',title: 'COD排放减少量/年（吨）',  align: 'center', minWidth:145 },
                    // { key:'epRelatedAwards',title: '环保相关奖项',  align: 'center', minWidth:120 },
                    // { key:'relatedProjects',title: '与科研机构合作环保相关项目',  align: 'center', minWidth: 130 },
                    // { key:'createUserName',title: '填表人',  align: 'center', width: 140  },
                    // { key:'creatorPhone',title: '联系电话',  align: 'center', width: 140  },
                    // { key:'createDate',title: '填表时间',  align: 'center', width: 120, render: this.renderCellDate },
                    this.getActionColumns((params) => {
                        return params.index === 0;
                    })
                ],
                ruleCustom : {
                    companyId: [ { required: true, message: '请填写企业名称', trigger: 'change' } ],
                    rptPeroidDate:[ { required: true, message: '请填写', trigger: 'change', type:'date' } ],
					createMobile: [{ pattern: /^((0\d{2,3}-\d{7,8})|(1[3675849]\d{9}))$/, required: true, message: '请填写填表人电话', trigger: 'change' }],
                },
                tableHeight:10,
                dictMap: {},
                // 弹出框
                orgFieldOptions, // 各集团填报字段配置

                // api
                queryUrl:Api.queryEnRptAnnual,
                deleteUrl:Api.deleteEnRptAnnual,
                exportUrl:Api.exportEnRptAnnual,
                bthDeleteUrl:Api.batchDeleteEnRptAnnual,
                getUrl:Api.getEnRptAnnual,
                updateUrl:Api.updateEnRptAnnual,
                saveUrl:Api.saveEnRptAnnual,
            }
        },
        computed:{
            curOrgFieldOptions(){
                var resObj = this.orgFieldOptions[String(this.dataToView.belongOrgId)]
                if (!resObj){
                    resObj = {}
                }
                return resObj
            },
        },
        async mounted() {
            this.setTableHeight();
            // this.dataToQuery.yearDate = new Date()
            this.query();
        },
        methods:{
            ...pageCommonFunction,
            downloadDescriptionExcel(){
                window.open('年报填报说明.xls','_blank')
            },
            rowClassName(row, index) {
                if (index === 0) {
                    return 'table-summary-row';
                }
            },
            deleteData(params) {
                this.deleteDateAjax(params);
            },
            query() {
                if(this.dataToQuery.projectCateArrays) {
                    this.dataToQuery.projectCategories = this.arrayToInFormat(this.dataToQuery.projectCateArrays)
                }
                if(this.dataToQuery.yearDate) {
                    this.dataToQuery.year = this.dataToQuery.yearDate.getFullYear();
                }
                this.queryAjax();
            },
            submit(name) {
                if(this.dataToView.rptPeroidDate) {
                    this.dataToView.rptPeroid = this.dataToView.rptPeroidDate.getFullYear();
                }
                // this.dataToView.companyId = this.dataToView.belongOrgId;
                // this.dataToView.companyName = this.dataToView.belongOrgName;
                this.submitAjax(name);
            },
            // 弹出表单
            async beforeEditDialogOpen(data) {
                console.log(data.row)
                data.row.rptPeroidDate = new Date(data.row.rptPeroid + '-01-01');
                // data.row.belongOrgId = data.row.companyId;
                // data.row.belongOrgName = data.row.companyName;
            },
            // async afterDataToViewInit() {
            //     await this.getFiles('cementProcess')
            //     await this.getFiles('envBenefits')
            //     await this.getFiles('epRelatedAwards')
            //     await this.getFiles('relatedProjects')
            //     // this.dataToView.belongOrgId = this.dataToView.companyId;
            //     // this.dataToView.belongOrgName = this.dataToView.companyName;
            //     console.log(this.dataToView.cementProcessFiles);
            // },
            isFieldVisible(arr){
                var res = false
                for(var i=0,il=arr.length;i<il;i++){
                    var key = arr[i]
                    if (this.curOrgFieldOptions[key]) {
                        res = true
                        break
                    }
                }
                return res
            },
            createEmptyDataToAdd(){
                return {
                    ggEmissions:'',
                    exhaustEmission:'',
                    soEmission:'',
                    noxEmission:'',
                    pmEmission:'',
                    dioxinEmission:'',
                    otherEmission:'',
                    wasterWaterEmission:'',
                    codEmission:'',
                    hmiMission:'',
					hazardousWasteEmissions:'',
					hazardousWasteDensity:'',
					hazardousWasteDisposalRate:'',
                    oilTreatmentAmount:'',
                    paintTreatmentAmount:'',
                    otherTreatmentAmount:'',
					harmlessWasteDensity:'',
					harmlessWasteEmissions:'',
                    rockTreatmentAmount:'',
                    tailingsTreatmentAmount:'',
                    cementAmount:'',
                    otherWasterAmount:'',
                    isoAmount:'',
                    rdInvestment:'',
                    soReduceAmount:'',
                    noxReduceAmount:'',
                    pmReduceAmount:'',
                    waterReduceAmount:'',
                    codReduceAmount:'',
                    cementProcess:this.get_uuid(),
                    envBenefits:this.get_uuid(),
                    epRelatedAwards:this.get_uuid(),
                    relatedProjects:this.get_uuid(),
                    cementProcessFiles:[],
                    envBenefitsFiles:[],
                    epRelatedAwardsFiles:[],
                    relatedProjectsFiles:[],
					createMobile: sessionStorage('userId').getObject('userId').mobileNumber,
                }
            }
        },
        watch:{
        },

    }
</script>

<style lang='css' scoped>
    /deep/ .ivu-table .table-summary-row {
        border-top: 1px solid #e8eaec;
        background-color: #f8f8f9;
    }

    /deep/ .ivu-table .table-summary-row td {
        border-right: 1px solid #e8eaec;
        background-color: #f8f8f9;
    }

    /deep/ .left-right-indent-row > .ivu-col:nth-child(2n-1){
        /*margin-left: 19px;*/
    }
    /deep/ .left-right-indent-row > .ivu-col:nth-child(2n){
        /*margin-right: 19px;*/
    }
</style>
